package com.orkasgb.framework.springsecurity;

import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

import java.util.Collection;

public class OrkasgbJWTSecurityContextToken extends AbstractAuthenticationToken {

    private static final long serialVersionUID = 1L;

    private final Object principal;

    private final Object credentials;

    /**
     * Creates a token with the supplied array of authorities.
     *
     * @param authorities  the collection of <tt>GrantedAuthority</tt>s for the principal
     *                     represented by this authentication object.
     * @param authorities
     * @param principal
     */
    public OrkasgbJWTSecurityContextToken(Collection<? extends GrantedAuthority> authorities,Object credentials, Object principal) {
        super(authorities);
        this.principal = principal;
        this.credentials = credentials;
        setAuthenticated(true);
    }

    @Override
    public Object getCredentials() {
        return this.credentials;
    }

    @Override
    public Object getPrincipal() {
        return this.principal;
    }
}
